package duoqiao;

public class Text {
    public static void main(String[] args) {
        /*
        给元素赋值需要new一下  访问数组元素需要引用数组打点访问
         */
        Person[] p = new Person[3];
        p[0] = new Student("zhangsan",16,"LT",20.0);
        p[1] = new Teacher("liushuliang",25,"LLF","2019320111");
        p[2] = new Student("mm",22,"ooo",55.22);
        p[0].sayHi();
        for (int i = 0;i< p.length;i++){
            System.out.println(p[i].name);
            p[i].sayHi();
        }
    }
}
